package com.vanzo.encryption;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.widget.TextView;

import com.vanzo.encryption.Pdt;
import com.vanzo.talkie.BaseActivity;
import com.vanzo.talkie2.R;
import com.vanzo.util.LogUtil;


/**
 * Created by tisen on 2018/1/31.
 */

public class MainActivity extends BaseActivity {
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_so);
        Pdt pdt = new Pdt();
        TextView test = (TextView) findViewById(R.id.so_text);
        TextView test1 = (TextView) findViewById(R.id.so1_text);
        test.setText(stringFromJNI());
        byte[] inValue = Pdt.hexStringToByteArray("Hello World!");
        byte[] outValue = new byte[Pdt.MAX_BUFFER_LEN];
        Integer oLen = new Integer(0);
        int ret = Pdt.systemCommand(inValue, outValue, oLen);
        if (ret >= 0)
            test.setText("success");

        int ret1 = Pdt.getSuperkey2NFC(1, 1, 1, inValue, oLen);
        if (ret1 >= 0)
            test1.setText("success");
        LogUtil.put(this, outValue.toString(), LogUtil.WARN);
    }

    public native String stringFromJNI();

    static {
        System.loadLibrary("native-lib");
    }
}
